<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <title>淘金客</title>
  <link rel="icon" href="./static/logo.png">
  <link href='https://cdn.bootcss.com/social-share.js/1.0.16/css/share.min.css' rel="stylesheet">
  <script src='https://cdn.bootcss.com/social-share.js/1.0.16/js/social-share.min.js'></script>
  <script src="http://www.shandw.com/libs/js/sdwJs.min.js" type="text/javascript"></script>
  <script src='./static/mui.min.js'></script>
  <script src='./static/OpenApp.js'></script>
</head>

<body>
  <div id="app"></div>
  <!-- built files will be auto injected -->
</body>
<script>
  window.IsSureQuit = false;
  window.noBack = false;
  mui.plusReady(() => {
    plus.key.removeEventListener('backbutton', function () { });
    plus.key.addEventListener('backbutton', function () {
      if (typeof window.noBack === "function") {
        window.noBack();
        return;
      }
      let pathName = window.location.hash;
      // tabbar路由
      let isTabbar = ["#/", "#/informationPage", "#/playGame", "#/gamePage", "#/personalCenter"].findIndex(elem => elem === pathName);
      // 特殊路由
      let isOther = ["#/login", "#/register"].findIndex(elem => elem === pathName);
      plus.nativeUI.toast(window.location.path);
      if (isTabbar > -1) {
        if (window.IsSureQuit) {
          plus.runtime.quit();
        } else {
          plus.nativeUI.toast("再按一次退出程序");
          window.IsSureQuit = true;
          setTimeout(() => {
            window.IsSureQuit = false;
          }, 2000);
        }
      } else {
        if (history.length > 2 && isOther > -1) {
          window.location = "./index.html";
          // history.go(-2);
        } else {
          history.back();
        }
      }
    });
  });
</script>

</html>